<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a = 1;
      function a() {
        console.log(a);
        let a = 2;
      }
      console.log(a); // 1
      a();

      /**
       * 1. 函数声明优先级高于变量声明
       *
       * var a;
       * function a(){
       *    ......
       * }
       * a = 1
       * log(a) // 1
       * a() // 报错
       * **/
    </script>
  </body>
</html>
